﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BE.Common.User;
using System.Collections.ObjectModel;
using BE.Web.Betfair.Interface.Entities;
using BE.Web.Betfair.Interface.Requests;
using System.Diagnostics.Contracts;
using BE.EBC;

namespace BE.Web.Betfair.Interface
{
    /// <summary>
    /// The common interface for the betfair adapter
    /// </summary>
    /// <seealso href="http://bdp.betfair.com/"/>
    [ContractClass(typeof(BetfairAdapterCC))]
    public interface IBetfairAdapter 
    {
        /// <summary>
        /// BetFair Product Request
        /// </summary>
        /// <returns></returns>
        Session Login(Credentials credentials,BetfairProduct product);

        /// <summary>
        /// Logout
        /// </summary>
        /// <param name="session"></param>
        void Logout(Session session);

        /// <summary>
        /// Retrieves all Markets
        /// </summary>
        /// <returns>Returns all Markets</returns>
        ReadOnlyCollection<BetMarket> GetAllMarkets(Session session);

        /// <summary>
        /// Retrieves all events
        /// </summary>
        /// <param name="session"></param>
        /// <returns></returns>
        ReadOnlyCollection<BetEventType> GetAllEventTypes(Session session);

        /// <summary>
        /// Seends a Keepalive signal
        /// </summary>
        void KeepAlive(Session session);

        /// <summary>
        /// Gets the events of the given type.
        /// </summary>
        /// <param name="eventType">Type of the event.</param>
        /// <returns></returns>
        void GetEventsOfType(BetEventByTypeRequest eventType);

        /// <summary>
        /// Resolves the Markets of the given event
        /// </summary>
        /// <param name="request">ReadRequest</param>
        void GetMarketsOfEvent(EventMarketsRequest request);

        /// <summary>
        /// Retrieves subevents
        /// </summary>
        /// <param name="request">ReadRequest</param>
        void AddMarketsAndSubEvents(BetEventByParentEventRequest request);

        /// <summary>
        /// Requests the funding informations of a user
        /// </summary>
        /// <param name="request"></param>
        void GetUserFund(UserFundsRequest request);

        /// <summary>
        /// Requests the Bets of a given Market
        /// </summary>
        /// <param name="request"></param>
        void GetBetsOfMarket(BetsByMarketRequest request);

        /// <summary>
        /// Requests the prices of a market
        /// </summary>
        /// <param name="request"></param>
        void GetMarketPrices(MarketPriceRequest request);

        /// <summary>
        /// Output pin for user defined log / trace tools
        /// </summary>
        event Action<object, string, EBCTraceLevel> Out_Trace;
    }
}
